//
//  LDTTopicDetailsController.m
//  EPA
//
//  Created by lanou3g on 16/4/23.
//  Copyright © 2016年 浮夸. All rights reserved.
//

#import "LDTTopicDetailsController.h"
#import "LDTNetWorkRequestManager.h"
#import "BaseModel.h"
@interface LDTTopicDetailsController ()

@end

@implementation LDTTopicDetailsController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
    webView.backgroundColor = [UIColor cyanColor];
    [self.view addSubview:webView];
    
    [LDTNetWorkRequestManager requestURL:[NSURL URLWithString:TOPICINFO_URL] Method:LDT_POST Params:@{@"contentid":self.contentID,@"client":@"1",@"deviceid":@"63A94D37-33F9-40FF-9EBB-481182338873",@"auth":@"Wc06FCrkoq1DCMVzGMTikDJxQ8bm3Mrm2NpT9qWjwzcWP23tBKQx1c4P0",@"version":@"3.0.2"}
 Result:^(NSData *data, NSURLResponse *response, NSError *error) {
    
   //  NSLog(@"%@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]) ;
     
     NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
     NSDictionary *dataDict = jsonDict[@"data"];
     NSDictionary *postsDict = dataDict[@"postsinfo"];
     NSDictionary *shareDict = postsDict[@"shareinfo"];
     NSString *urlStr = shareDict[@"url"];
     //NSLog(@"%@",urlStr);
     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
 
 }];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
